/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package VISUAL;

import DAL.ConectaBd;
import java.sql.*;
import javax.swing.ComboBoxModel;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;

/**
 *
 * @author MAYCON
 */
public class frmContasaPagar extends javax.swing.JInternalFrame {
    
    Connection con = null;
    Connection conecta;
    PreparedStatement pst;
    ResultSet rs;

    /**
     * Creates new form frmContasaPagar
     */
    public frmContasaPagar() throws ClassNotFoundException {
        initComponents();
        this.setLocation(450,100);
        conecta = ConectaBd.conectabd();
        con = ConectaBd.conectabd();
        this.PopulacomboboxFornecedorEscolha();
        ListarContas();
    }
    
    public void ListarContas()//Método para aparecer na tabela os dados das contas a pagar
    {
        String sql = "Select *from contasapagar order by id Asc";// order by codigo Asc para deixar em ordem por código crescente
        try
        {
            pst = conecta.prepareStatement(sql);
            rs = pst.executeQuery();
            tblcontas.setModel(DbUtils.resultSetToTableModel(rs));
            
        }
        catch(SQLException error)
        {
            JOptionPane.showMessageDialog(null,error);
        }    
    }
    
    public void PesquisarContasaPagar()//Método a qual irá funcionar o campo pesquisar
    {
        String sql = "Select *from contasapagar where fornecedor like ?";
        
        try
        {
            pst = conecta.prepareStatement(sql);
            pst.setString(1,txtBusca.getText()+"%");
            rs = pst.executeQuery();
            tblcontas.setModel(DbUtils.resultSetToTableModel(rs));
            
        }
        catch(SQLException error)
        {
            JOptionPane.showMessageDialog(null,error);
        }    
    }
    
    public void cadastrarUsuarios()//metodo para funcionar o cadastro de usuários no botão cadastrar
    {
        String sql = "Insert into contasapagar (fornecedor,nota,dataentrada,valor,numfatura,vencimento,tipofatura,obs,situacao)values(?,?,?,?,?,?,?,?,?)";
        try
        {
            pst = conecta.prepareStatement(sql);
            pst.setString(1, (String) jComboBoxFornecedor.getSelectedItem());
            pst.setString(2,txtNotaFiscal.getText());
            pst.setString(3,txtData.getText());
            pst.setString(4,txtValor.getText());
            pst.setString(5,txtNumerodaFatura.getText());
            pst.setString(6,txtVencimento.getText());
            pst.setString(7, (String) jComboBoxTipo.getSelectedItem());
            pst.setString(8,txtObs.getText());
            pst.setString(9,(String) jComboBoxSituacao.getSelectedItem());
            
            
            pst.execute();
            JOptionPane.showMessageDialog(null, "Conta cadastrada com sucesso","Conta cadastrada com sucesso",JOptionPane.INFORMATION_MESSAGE);
            ListarContas();
        }
        catch (SQLException error)
        {
            JOptionPane.showMessageDialog(null, error);
        }
    }
    
    public void PopulacomboboxFornecedorEscolha()
    {
        String sql = "select cadfornecedor.fantasia, tipodeconta.tipo from cadfornecedor,tipodeconta ";
            
        
        
        try
        {
            pst = con.prepareStatement(sql);
            rs = pst.executeQuery();
                    
            while(rs.next())
            {
                jComboBoxFornecedor.addItem(rs.getString("fantasia"));
                jComboBoxTipo.addItem(rs.getString("tipo"));
                
            }
            
        }catch(SQLException ex)
        {
            JOptionPane.showMessageDialog(null, ex);
        }
    }
    
    public void ComboboxContas()
    {
        String sql = "select fantasia from cadfornecedor as A join tipodeconta as tipo(fantasia.chaveEstrangeiraQueApontaParatipodeconta = tipodeconta.chavePrimaria)";
        
        
        
        try
        {
            pst = con.prepareStatement(sql);
            pst.setString(1, (String) jComboBoxFornecedor.getSelectedItem());
            pst.setString(2, (String) jComboBoxTipo.getSelectedItem());
            
            
            rs = pst.executeQuery();
            
        }
        catch(SQLException error)
        {
            JOptionPane.showMessageDialog(null, error);
        }    
    }
    
    public void LimparCamposConta()//metodo para funcionar o botão limpar ao clica-lo
    {
        txtId.setText("");
        txtData.setText("");
        txtNumerodaFatura.setText("");
        txtNotaFiscal.setText("");
        txtValor.setText("");
        txtVencimento.setText("");
        txtObs.setText("");
        
        
    }
    
    public void MostrarContas()//Este metodo ao clicar no cheque irá mostrar nos campos todas informações cadastradas, utilizado para deletar e editar
    {
        int seleciona = tblcontas.getSelectedRow();
        txtId.setText(tblcontas.getModel().getValueAt(seleciona,0).toString());
        //jComboBoxFornecedor.setText(tblcontas.getModel().getValueAt(seleciona,1).toString()); deixei em em comentário pois talvez ñ use
        txtNotaFiscal.setText(tblcontas.getModel().getValueAt(seleciona,2).toString());
        txtData.setText(tblcontas.getModel().getValueAt(seleciona,3).toString());
        txtValor.setText(tblcontas.getModel().getValueAt(seleciona,4).toString());
        txtNumerodaFatura.setText(tblcontas.getModel().getValueAt(seleciona,5).toString());
        txtVencimento.setText(tblcontas.getModel().getValueAt(seleciona,6).toString());
        //jComboBoxTipo.setText(tblcontas.getModel().getValueAt(seleciona,7).toString());
        txtObs.setText(tblcontas.getModel().getValueAt(seleciona,8).toString());
        //jComboBoxSituacao.setText(tblcontas.getModel().getValueAt(seleciona,9).toString());   
        
    }
    
    public void EditarContas()//Este método excluir o cheque após clicado na opção delete
    {
        String sql =  "Update contasapagar set fornecedor = ?,nota = ?,dataentrada = ?,valor = ?,numfatura = ?,vencimento = ?,tipofatura = ?,obs = ?,situacao = ? where id = ?";
        
        try
        {
            pst = conecta.prepareStatement(sql);
            pst.setString(1, (String) jComboBoxFornecedor.getSelectedItem());
            pst.setString(2,txtNotaFiscal.getText());
            pst.setString(3,txtData.getText());
            pst.setString(4,txtValor.getText());
            pst.setString(5,txtNumerodaFatura.getText());
            pst.setString(6,txtVencimento.getText());
            pst.setString(7, (String) jComboBoxTipo.getSelectedItem());
            pst.setString(8,txtObs.getText());
            pst.setString(9,(String) jComboBoxSituacao.getSelectedItem());
            pst.setInt(10,Integer.parseInt(txtId.getText()));
            pst.executeUpdate();
            JOptionPane.showMessageDialog(null,"Cadastro atualizado com sucesso");
            ListarContas();
        }
        catch (SQLException error)
        {
            JOptionPane.showMessageDialog(null, error);
        }    
    }
    
    public void DeletarConta()
    {
        String sql = "Delete from contasapagar where id = ?";//Metodo para exclusão de conta pelo botão
        
        try
        {
            pst = conecta.prepareStatement(sql);
            pst.setInt(1,Integer.parseInt(txtId.getText()));
            pst.execute();
            ListarContas();
        }
        catch(SQLException error)
        {
            JOptionPane.showMessageDialog(null,error);
            
            
        }
    }
    
    
    
       
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jComboBoxFornecedor = new javax.swing.JComboBox();
        txtNotaFiscal = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtNumerodaFatura = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtData = new javax.swing.JFormattedTextField();
        jLabel4 = new javax.swing.JLabel();
        txtValor = new javax.swing.JFormattedTextField();
        jLabel5 = new javax.swing.JLabel();
        txtVencimento = new javax.swing.JFormattedTextField();
        jLabel6 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtObs = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblcontas = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        txtId = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        txtBusca = new javax.swing.JTextField();
        jComboBoxTipo = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        jComboBoxSituacao = new javax.swing.JComboBox();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        setClosable(true);
        setIconifiable(true);
        setTitle("Contas a Pagar");

        jLabel1.setText("Fornecedor");

        jLabel2.setText("Nº Fatura");

        jLabel3.setText("Nota Fiscal");

        try {
            txtData.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel4.setText("Data");

        txtValor.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));

        jLabel5.setText("Valor");

        try {
            txtVencimento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel6.setText("Vencimento");

        jLabel7.setText("Tipos de Fatura");

        jLabel8.setText("Obs");

        tblcontas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblcontas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblcontasMouseClicked(evt);
            }
        });
        tblcontas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tblcontasKeyReleased(evt);
            }
        });
        jScrollPane2.setViewportView(tblcontas);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ICONES/disk.png"))); // NOI18N
        jButton1.setText("Cadastrar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ICONES/arrow_refresh.png"))); // NOI18N
        jButton2.setText("Atualizar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ICONES/delete.png"))); // NOI18N
        jButton4.setText("Limpar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ICONES/cancel.png"))); // NOI18N
        jButton3.setText("Deletar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        txtId.setEnabled(false);

        jLabel9.setText("Id");

        jLabel10.setText("Situação");

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ICONES/zoom.png"))); // NOI18N
        jLabel11.setText("BUSCAR");

        txtBusca.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtBuscaKeyReleased(evt);
            }
        });

        jLabel12.setText("Tipo");

        jComboBoxSituacao.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jComboBoxSituacao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pagamento Realizado (SIM)", "Pagamento Não Realizado (NÃO)" }));
        jComboBoxSituacao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxSituacaoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 704, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(txtValor))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                .addComponent(jLabel9)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(txtId))
                                            .addComponent(jLabel1))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(txtData, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(9, 9, 9)
                                        .addComponent(jLabel6))
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel2)))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNumerodaFatura, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                    .addComponent(txtVencimento)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtObs))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButton1)
                                    .addComponent(jButton2)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jButton4)
                                        .addGap(18, 18, 18)
                                        .addComponent(jButton3)))
                                .addGap(26, 26, 26))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator1)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jComboBoxFornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 0, Short.MAX_VALUE)))))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtBusca, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator2))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jComboBoxSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jComboBoxFornecedor, jComboBoxTipo, txtData, txtNotaFiscal, txtNumerodaFatura, txtValor, txtVencimento});

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton1, jButton2, jButton3, jButton4});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtNumerodaFatura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)
                            .addComponent(jLabel1)
                            .addComponent(jComboBoxFornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtValor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(txtVencimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6)
                            .addComponent(txtNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(34, 34, 34)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton4)
                            .addComponent(jButton3))
                        .addGap(18, 18, 18))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addGap(48, 48, 48)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(txtObs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jComboBoxSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtBusca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jComboBoxFornecedor, jComboBoxSituacao, jComboBoxTipo, txtData, txtId, txtNotaFiscal, txtNumerodaFatura, txtValor, txtVencimento});

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton1, jButton2, jButton3, jButton4});

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tblcontasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblcontasMouseClicked
        // TODO add your handling code here:
        MostrarContas();
    }//GEN-LAST:event_tblcontasMouseClicked

    private void tblcontasKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tblcontasKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_tblcontasKeyReleased

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // Este é o botão cadastro do cheque, e ele está chamando o método :
        cadastrarUsuarios();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // Este é o botão do atualizar, ele irá chamar o método:
        EditarContas();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // Botão com método para limpar dados dos campos contas:
        LimparCamposConta();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // Botão com método para deletar fornecedor:
        DeletarConta();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void txtBuscaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscaKeyReleased
        // TODO add your handling code here:
        PesquisarContasaPagar();
    }//GEN-LAST:event_txtBuscaKeyReleased

    private void jComboBoxSituacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSituacaoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBoxSituacaoActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JComboBox jComboBoxFornecedor;
    private javax.swing.JComboBox jComboBoxSituacao;
    private javax.swing.JComboBox jComboBoxTipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable tblcontas;
    private javax.swing.JTextField txtBusca;
    private javax.swing.JFormattedTextField txtData;
    private javax.swing.JTextField txtId;
    private javax.swing.JTextField txtNotaFiscal;
    private javax.swing.JTextField txtNumerodaFatura;
    private javax.swing.JTextField txtObs;
    private javax.swing.JFormattedTextField txtValor;
    private javax.swing.JFormattedTextField txtVencimento;
    // End of variables declaration//GEN-END:variables
}
